//封装一个通用的事件监听函数
function bindEvent(elem,type,fn) {
    elem.addEventListener(type,fn);

}
let btn = document.querySelector('.btn');
let a = 100
bindEvent(btn,'click',e=>{
    console.log(100);
    console.log('点击了按钮');
    alert(e.target); //输出被点击的元素
})
bindEvent(document.body,'click',e=>{
    console.log("触发了事件冒泡");
})
